using System;
using System.IO;
using System.Collections.Generic;
using System.Security.AccessControl;

namespace Caramel.IO
{
	public class WindowsDirectory : IDirectory
	{
		#region IDirectory Members

		public IDirectoryInfo CreateDirectory(string path, DirectorySecurity directorySecurity)
		{
			return
				new WindowsDirectoryInfo(
					Directory.
						CreateDirectory(
							path,
							directorySecurity
						)
				);
		}

		public void Delete(string path, bool recursive)
		{
			Directory.Delete(path, recursive);
		}

		public bool Exists(string path)
		{
			return Directory.Exists(path);
		}

		public string GetCurrentDirectory()
		{
			return Directory.GetCurrentDirectory();
		}

		public IEnumerable<string> GetDirectories(string path, string searchPattern, SearchOption searchOption)
		{
			return
				Directory.
					GetDirectories(
						path,
						searchPattern,
						searchOption
					);
		}

		public string GetDirectoryRoot(string path)
		{
			return Directory.GetDirectoryRoot(path);
		}

		public IEnumerable<string> GetFiles(string path, string searchPattern, SearchOption searchOption)
		{
			return
				Directory.
					GetFiles(
						path, 
						searchPattern, 
						searchOption
					);
		}

		public IDirectoryInfo GetParent(string path)
		{
			return
				new WindowsDirectoryInfo(
					Directory.GetParent(path)
				);
		}

		public void Move(string sourceDirName, string destDirName)
		{
			Directory.Move(sourceDirName, destDirName);
		}

		#endregion
	}
}
